package topday1_9.demo4;

/**
 * @Auther:小陈的Java
 */
public class Demo1 {
    public static void main(String[] args) {
        int i = 1;
        int j = 1;
        System.out.println(i==j);
        User user = new User(1, "小红");
        User user2 = new User(1, "小红");
        User user3 = user;
        System.out.println(user==user2);
        System.out.println(user==user3);
        System.out.println(user.equals(user2));
        System.out.println(user.equals(user3));
        String str = new String("abc");
        String str2 = new String("abc");
        System.out.println(str.equals(str2));
    }
}
class User{
    private int id;
    private String name;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public User(int id, String name) {
        this.id = id;
        this.name = name;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public User() {
    }

}
